package com.feicheng.controller.wx;

import com.alibaba.fastjson.JSONObject;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.service.a.FMdService;
import com.feicheng.service.a.FZjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wx/zj")
public class ZjController {

    @Autowired
    FMdService fMdService;

    @Autowired
    FZjService fzjService;

    @PostMapping("/zjgs/info")
    public ResultInfo saveZjgs(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.saveZjgs(param));
    }

    @PostMapping("/info/get")
    public ResultInfo getzj(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.getZj(param));
    }

    @PostMapping("/all/get")
    public ResultInfo getzjs(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.getZjs(param));
    }

    @PostMapping("/zjgs/info/get")
    public ResultInfo getzjgs(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.getZjgs(param));
    }

    @PostMapping("/zjgs/all/get")
    public ResultInfo getzjgsall(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.getZjgsAll(param));
    }

    @PostMapping("/zjsq/all/get")
    public ResultInfo getzjsqall(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.getZjsqitems(param));
    }

    @PostMapping("/zjsq/info/delete")
    public ResultInfo deletezjsq(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.deleteZjsqitems(param));
    }

    @PostMapping("/zjsq/info/post")
    public ResultInfo newZjsq(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.newZjsq(param));
    }

    @PostMapping("/info/put")
    public ResultInfo updatezj(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.updateZj(param));
    }

    @PostMapping("/commission/items/page")
    public ResultInfo getciByPage(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.getCommissionitemByPage(param));
    }

    @PostMapping("/commission/item/info/get")
    public ResultInfo getci(@RequestBody JSONObject param) {
        return ResultInfo.success(fzjService.getCommissionitem(param));
    }

    @PostMapping("/commission/items")
    public ResultInfo getStoreDetailWithCommission(@RequestBody JSONObject param) {
        JSONObject storeResult = fMdService.getMd(param);
        return ResultInfo.success(fzjService.getCommissionitems(storeResult));
    }

}
